<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class ShopRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'name' => 'required|unique:shops,name,'.$this->id.'|max:100',
            'contacter' => 'nullable|string',
            'phone'   => 'required',           
            'license' => 'required',           
        ];
    }

    public function messages()
    {
        return [
            'name.required' => '商户名 不能为空',           
            'license.required' => '验证码不能为空',          
        ];
    }

    public function pure()
    {
        return  array_except($this->all(), ['_token','_method']);
    }
}
